package com.woniu.supermarket.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.supermarket.mapper.SalesMapper;
import com.woniu.supermarket.service.ISalesService;
import com.woniu.supermarket.vo.SalesVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SalesServiceImpl implements ISalesService {

    @Autowired
    SalesMapper salesMapper;

    @Override
    public PageInfo<SalesVo> findByCons(Integer now, Integer size, String salesCode) {
        PageHelper.startPage(now,size);
        List<SalesVo> lists = salesMapper.selectByCons(salesCode);
        return new PageInfo<>(lists);
    }

    @Override
    public void reset(SalesVo sales) {
        salesMapper.updatePriceByPrimaryKey(sales);
    }
}
